<?php
/**
 * 店铺相关配置
 * Date: 2021年3月4日
 * Time: 18:06:03
 */
namespace App\Model\BbcModel;
use App\Model\BaseModel\BaseBbcModel;
use Service\Code\Normal;

class StoreConfig extends BaseBbcModel
{
    public $table = 'ly_store_config';

    public function getConfig(array $param = []): array
    {
        if (empty($param['code'])) {
            return Normal::returnCode(Normal::PARAM_BUS_ERROR,'expect param code');
        }
        if (empty($param['mn_sid'])) {
            return Normal::returnCode(Normal::PARAM_BUS_ERROR,'expect param mn_sid');
        }
        $data = $this->info(['code' => $param['code'], 'mn_sid' => $param['mn_sid'], 'status' => 1]);
        if (empty($data)) {
            return Normal::returnCode(Normal::FAIL,'config not exist');
        }
        $data['value'] = !empty(json_decode($data['value'])) ? json_decode($data['value'], true) : $data['value'];
        return Normal::returnCode(Normal::SUC,'获取成功',$data);
    }
}